home *** CD-ROM | disk | FTP | other *** search
- on Multipli___________________________
- end
-
- on InitMulti
- global gMultiAll, gMaxMulti, gCurrMulti, gRowsMulti, glineHeightMulti, gTempMultiOnList, gMultiOnList, gTempMultiPathSourceList, gMultiPathSourceList, gTempMultiPathDestList, gMultiPathDestList, gRememberMultiList
- set gMultiAll to 0
- set gRememberMultiList to 0
- set gMaxMulti to 7
- set gCurrMulti to 1
- set gRowsMulti to 7
- set gTempMultiOnList to []
- set gMultiOnList to []
- set gTempMultiPathSourceList to []
- set gMultiPathSourceList to []
- set gTempMultiPathDestList to []
- set gMultiPathDestList to []
- repeat with i = 1 to gMaxMulti
- append(gTempMultiOnList, 1)
- append(gMultiOnList, 1)
- append(gTempMultiPathSourceList, 0)
- append(gMultiPathSourceList, 0)
- append(gTempMultiPathDestList, 0)
- append(gMultiPathDestList, 0)
- end repeat
- set glineHeightMulti to 18
- set the textHeight of member "fOnOffMulti" to glineHeightMulti
- set the textHeight of member "fSourceList" to glineHeightMulti
- set the textHeight of member "fDestList" to glineHeightMulti
- set the scrollTop of member "fOnOffMulti" to 0
- set the scrollTop of member "fSourceList" to 0
- set the scrollTop of member "fDestList" to 0
- end
-
- on GoMulti
- global gTempMultiAll, gMultiAll, gTempMultiOnList, gMultiOnList, gTempMultiPathSourceList, gMultiPathSourceList, gTempMultiPathDestList, gMultiPathDestList, gMaxMulti, gGrigio, gNero, gSep
- if voidp(gMultiAll) then
- set gMultiAll to 0
- end if
- set gTempMultiAll to gMultiAll
- put EMPTY into field "fSourceList"
- put EMPTY into field "fDestList"
- set the foreColor of field "fOnOffMulti" to gNero
- set the foreColor of field "fSourceList" to gNero
- set the foreColor of field "fDestList" to gNero
- set tempSources to EMPTY
- set tempDests to EMPTY
- set gTempMultiOnList to value(string(gMultiOnList))
- set gTempMultiPathSourceList to value(string(gMultiPathSourceList))
- set gTempMultiPathDestList to value(string(gMultiPathDestList))
- set oldDelimiter to the itemDelimiter
- set the itemDelimiter to gSep
- repeat with i = 1 to gMaxMulti
- set myItem to getAt(gTempMultiPathSourceList, i)
- if myItem = 0 then
- set myItem to " "
- else
- set myItem to the last item in myItem
- end if
- put myItem & RETURN after tempSources
- set myItem to getAt(gTempMultiPathDestList, i)
- if myItem = 0 then
- set myItem to " "
- else
- set myItem to the last item in myItem
- end if
- put myItem & RETURN after tempDests
- end repeat
- set the itemDelimiter to oldDelimiter
- delete char -30000 of tempSources
- delete char -30000 of tempDests
- put tempSources into field "fSourceList"
- put tempDests into field "fDestList"
- repeat with i = 1 to gMaxMulti
- if not getAt(gTempMultiOnList, i) then
- set the foreColor of line i of field "fOnOffMulti" to gGrigio
- set the foreColor of line i of field "fSourceList" to gGrigio
- set the foreColor of line i of field "fDestList" to gGrigio
- end if
- end repeat
- go("Multi")
- SetMenuCredits()
- end
-
- on SetOneMultipleOnOff myLinea
- global gTempMultiOnList, gGrigio, gNero
- set a to the foreColor of char 1 of line myLinea of field "fOnOffMulti" = gNero
- set a to not a
- if a then
- set colore to gNero
- set myValore to 1
- else
- set colore to gGrigio
- set myValore to 0
- end if
- set the foreColor of char 1 of line myLinea of field "fOnOffMulti" to colore
- set the foreColor of line myLinea of field "fSourceList" to colore
- set the foreColor of line myLinea of field "fDestList" to colore
- setAt(gTempMultiOnList, myLinea, myValore)
- end
-
- on AskForOneMultipleSource myLinea
- global gTempMultiPathSourceList, gTempMultiPathDestList, gSep, gMultiPathSourceList
- if the optionDown then
- put " " into line myLinea of field "fSourceList"
- setAt(gTempMultiPathSourceList, myLinea, 0)
- else
- set theFolder to getAt(gTempMultiPathSourceList, myLinea)
- if theFolder <> 0 then
- if OSIsDirectory(theFolder & gSep) = 1 then
- dosSetCurrentFolder(ExtractParentFolder(theFolder))
- end if
- end if
- set myFolder to OSSelectFolder()
- if myFolder <> 0 then
- set myTempDest to getAt(gTempMultiPathDestList, myLinea)
- if (stringp(myTempDest) = 1) and (myFolder = (myTempDest & gSep)) then
- AlertBox("You cannot choose the same Folder two times.")
- exit
- end if
- put ExtractFileNameFromPath(myFolder) into line myLinea of field "fSourceList"
- delete char -30000 of myFolder
- setAt(gTempMultiPathSourceList, myLinea, myFolder)
- end if
- end if
- end
-
- on AskForOneMultipleDest myLinea
- global gTempMultiPathSourceList, gTempMultiPathDestList, gSep
- if the optionDown then
- put " " into line myLinea of field "fDestList"
- setAt(gTempMultiPathDestList, myLinea, 0)
- else
- set theFolder to getAt(gTempMultiPathDestList, myLinea)
- if theFolder <> 0 then
- if OSIsDirectory(theFolder & gSep) = 1 then
- dosSetCurrentFolder(ExtractParentFolder(theFolder))
- end if
- end if
- set myFolder to OSSelectFolder()
- if myFolder <> 0 then
- set myTempSource to getAt(gTempMultiPathSourceList, myLinea)
- if (stringp(myTempSource) = 1) and (myFolder = (myTempSource & gSep)) then
- AlertBox("You cannot choose the same Folder two times.")
- exit
- end if
- put ExtractFileNameFromPath(myFolder) into line myLinea of field "fDestList"
- delete char -30000 of myFolder
- setAt(gTempMultiPathDestList, myLinea, myFolder)
- end if
- end if
- end
-
- on DoPopChain myMember, riga
- global gSep, gTempMultiPathSourceList, gTempMultiPathDestList, gMyStageWidth, gMyStageHeight
- if myMember = "fSourceList" then
- set mySprite to 23
- set myPath to getAt(gTempMultiPathSourceList, riga)
- else
- set mySprite to 24
- set myPath to getAt(gTempMultiPathDestList, riga)
- end if
- if line riga of field myMember = " " then
- exit
- end if
- set oldDelimiter to the itemDelimiter
- set the itemDelimiter to gSep
- set numItem to the number of items in myPath
- set myChain to EMPTY
- repeat with i = 0 to numItem - 1
- set k to numItem - i
- put item k of myPath & RETURN after myChain
- end repeat
- delete char -30000 of myChain
- set the itemDelimiter to oldDelimiter
- put myChain into field "fPopChain"
- set myH to the left of sprite mySprite - 1
- set myV to ((riga - 1) * 18) - 1 + the top of sprite mySprite
- if (myV + the height of member "fPopChain" + 4) > gMyStageHeight then
- set myV to gMyStageHeight - the height of member "fPopChain" - 4
- end if
- set the loc of sprite 58 to point(myH, myV)
- updateStage()
- repeat while the stillDown
- end repeat
- set the loc of sprite 58 to point(1000, 1000)
- updateStage()
- put " " into field "fPopChain"
- end
-
- on ApplyMulti
- global gTempMultiAll, gTempMultiOnList, gTempMultiPathSourceList, gTempMultiPathDestList
- set err to ImpostaMultiList(gTempMultiAll, gTempMultiOnList, gTempMultiPathSourceList, gTempMultiPathDestList)
- if err then
- exit
- end if
- if not gTempMultiAll then
- ImpostaNoMultiXLists()
- end if
- CheckSyncButton()
- GoLista()
- end
-
- on ImpostaMultiList xTempMultiAll, xTempMultiOnList, xTempMultiPathSourceList, xTempMultiPathDestList
- global gMultiAll, gMultiOnList, gMultiPathSourceList, gMultiPathDestList, gMultiXSource, gMultiXDest, gSourceFolder, gDestFolder, gMaxMulti, gSep
- set xMultiXSource to []
- set xMultiXDest to []
- set k to 0
- repeat with i = 1 to gMaxMulti
- if getAt(xTempMultiOnList, i) then
- set iSource to getAt(xTempMultiPathSourceList, i)
- set iDest to getAt(xTempMultiPathDestList, i)
- set SourceDefin to stringp(iSource) = 1
- set DestDefin to stringp(iDest) = 1
- if SourceDefin and not DestDefin and xTempMultiAll then
- if the frameLabel = "Multi" then
- AlertBox("Cannot set an empty destination folder in line" && i & ".")
- end if
- return 1
- next repeat
- end if
- if not SourceDefin and DestDefin and xTempMultiAll then
- if the frameLabel = "Multi" then
- AlertBox("Cannot set an empty source folder in line" && i & ".")
- end if
- return 1
- next repeat
- end if
- if SourceDefin and DestDefin and xTempMultiAll then
- set iSource to iSource & gSep
- set iDest to iDest & gSep
- if OSIsDirectory(iSource) <> 1 then
- if the frameLabel = "Multi" then
- AlertBox("Source Folder in line" && i && "not found.")
- end if
- return 1
- else
- if OSIsDirectory(iDest) <> 1 then
- if the frameLabel = "Multi" then
- AlertBox("Destination Folder in line" && i && "not found.")
- end if
- return 1
- end if
- end if
- set k to k + 1
- append(xMultiXSource, iSource)
- append(xMultiXDest, iDest)
- end if
- end if
- end repeat
- if (k = 0) and xTempMultiAll then
- if the frameLabel = "Multi" then
- AlertBox("Cannot set an empty list on.")
- end if
- return 1
- end if
- if the frameLabel = "Multi" then
- set gMultiAll to xTempMultiAll
- set gMultiOnList to value(string(xTempMultiOnList))
- set gMultiPathSourceList to value(string(xTempMultiPathSourceList))
- set gMultiPathDestList to value(string(xTempMultiPathDestList))
- end if
- if xTempMultiAll then
- set gMultiXSource to value(string(xMultiXSource))
- set gMultiXDest to value(string(xMultiXDest))
- set gSourceFolder to getAt(gMultiXSource, 1)
- set gDestFolder to getAt(gMultiXDest, 1)
- put "Multiple Top Folders:" && string(k) into field "fSourceFolder"
- put "Multiple Bottom Folders:" && string(k) into field "fDestFolder"
- put " " into field "fItems"
- end if
- return 0
- end
-
- on ImpostaNoMultiXLists
- global gSourceFolder, gDestFolder, gTopFolder, gBottomFolder
- set gSourceFolder to gTopFolder
- set gDestFolder to gBottomFolder
- put AccorciaNome(gSourceFolder) into field "fSourceFolder"
- put AccorciaNome(gDestFolder) into field "fDestFolder"
- put " " into field "fItems"
- end
-
- on ImpostagSourceDestFolders
- global gMultiAll, gRememberMultiList, gMultiOnList, gMultiPathSourceList, gMultiPathDestList
- if gRememberMultiList then
- set err to ImpostaMultiList(gMultiAll, gMultiOnList, gMultiPathSourceList, gMultiPathDestList)
- if err then
- set gMultiAll to 0
- ImpostaNoMultiXLists()
- end if
- end if
- if not gMultiAll then
- ImpostaNoMultiXLists()
- end if
- end
-
- on DoMultiSynchronize
- global gMultiXSource, gMultiXDest, gIterMulti, gSourceFolder, gDestFolder, gTimerAll, gStopTimerAll
- GoLista()
- PreSynchronizing()
- set numCicliMulti to count(gMultiXSource)
- repeat with gIterMulti = 1 to numCicliMulti
- set gSourceFolder to getAt(gMultiXSource, gIterMulti)
- set gDestFolder to getAt(gMultiXDest, gIterMulti)
- put AccorciaNome(gSourceFolder) into field "fSourceFolder"
- put AccorciaNome(gDestFolder) into field "fDestFolder"
- DoOneSynchronize(gIterMulti)
- end repeat
- FineMultiSync()
- end
-
- on FineMultiSync
- global gOneDirection, gBeepWhenDone, gIterMulti, gTimerAll, gStopTimerAll, gLastBackUpDate
- put " " into field "fItems"
- if gOneDirection then
- set myButton to "BackUp"
- if (gIterMulti - 1) > 1 then
- set myOperation to "BackUps"
- else
- set myOperation to "BackUp"
- end if
- else
- set myButton to "Synchronize"
- if (gIterMulti - 1) > 1 then
- set myOperation to "Synchronizations"
- else
- set myOperation to "Synchronization"
- end if
- end if
- put MyOperationBtn() into field "P4"
- put "•" && string(gIterMulti - 1) && "Multiple" && myOperation && "done." into field "fItems"
- FrecciaShortLog(1)
- put "Multiple Top Folders Done:" && string(gIterMulti - 1) into field "fSourceFolder"
- put "Multiple Bottom Folders Done:" && string(gIterMulti - 1) into field "fDestFolder"
- set gLastBackUpDate to [TodayYear(1), TodayMonth(1), TodayDay(1)]
- cursor(-1)
- set gTimerAll to gStopTimerAll
- beep(gBeepWhenDone)
- end
-
- on TastoMulti
- global gBianco, gNero
- if (the key = RETURN) or (charToNum(the key) = 3) then
- set mySprite to 39
- else
- if the keyCode = 53 then
- set mySprite to 36
- else
- exit
- end if
- end if
- set myBtnUp to the name of member the member of sprite mySprite
- set myTextMember to the member of sprite (mySprite + 1)
- set the member of sprite mySprite to BtnDw(myBtnUp)
- set the forecolor of myTextMember to gBianco
- updateStage()
- repeat with i = 0 to 15000
- end repeat
- set the member of sprite mySprite to myBtnUp
- set the foreColor of member myTextMember to gNero
- updateStage()
- if mySprite = 39 then
- ApplyMulti()
- else
- if mySprite = 36 then
- GoLista()
- end if
- end if
- end
-
- on AskDeleteAllMulti
- DialogBoxSiNo("Would you delete the multiple list?", "DeleteAllMulti", "nothing")
- end
-
- on DeleteAllMulti
- global gTempMultiOnList, gTempMultiPathSourceList, gTempMultiPathDestList, gMaxMulti, gNero
- updateStage()
- set stringa to " " & RETURN & " " & RETURN & " " & RETURN & " " & RETURN & " " & RETURN & " " & RETURN & " "
- put stringa into field "fSourceList"
- put stringa into field "fDestList"
- set the foreColor of field "fOnOffMulti" to gNero
- set the foreColor of field "fSourceList" to gNero
- set the foreColor of field "fDestList" to gNero
- repeat with i = 1 to gMaxMulti
- setAt(gTempMultiOnList, i, 1)
- setAt(gTempMultiPathSourceList, i, 0)
- setAt(gTempMultiPathDestList, i, 0)
- end repeat
- end
-
- on SaveListaMulti
- global gTempMultiOnList, gTempMultiPathSourceList, gTempMultiPathDestList
- set myFile to DisplaySaveMyFile("MultipleList")
- if myFile = EMPTY then
- exit
- end if
- if OSIsDirectory(myFile) = 0 then
- set err to OSDelete(myFile)
- if err then
- case err of
- (-47):
- set why to " because it's opened by another application."
- (-45):
- set why to " because it's locked."
- (-44):
- set why to " because the disk is locked."
- otherwise:
- set why to "."
- end case
- put "err" & err
- AlertBox("Cannot replace the file" && QUOTE & ExtractFileNameFromPath(myFile) & QUOTE & why)
- exit
- end if
- end if
- set mystringa to "global gTempMultiOnList, gTempMultiPathSourceList, gTempMultiPathDestList" & RETURN & RETURN & "set gTempMultiOnList=" & gTempMultiOnList & RETURN & "set gTempMultiPathSourceList=value(" & SostApici(string(gTempMultiPathSourceList)) & ")" & RETURN & "set gTempMultiPathDestList=value(" & SostApici(string(gTempMultiPathDestList)) & ")" & RETURN
- SaveTextFile(myFile, mystringa, "List", "FLSY")
- end
-
- on LoadListaMulti
- global gTempMultiOnList, gTempMultiPathSourceList, gTempMultiPathDestList
- set myFile to OSSelectFile(["List", "FLSY"])
- if myFile = 0 then
- exit
- end if
- if GetCreator(myFile) <> "FLSY" then
- AlertBox("This is not a FoldersSycnhonizer file.")
- exit
- end if
- set myscript to OpenMyFile(myFile)
- if myscript = 0 then
- AlertBox("Cannot read this file.")
- else
- do(myscript)
- SeLoadListaMulti()
- end if
- end
-
- on SeLoadListaMulti
- global gTempMultiAll, gMultiAll, gTempMultiOnList, gMultiOnList, gTempMultiPathSourceList, gMultiPathSourceList, gTempMultiPathDestList, gMultiPathDestList, gMaxMulti, gGrigio, gNero, gSep
- set pos22 to the loc of sprite 22
- set pos23 to the loc of sprite 23
- set pos24 to the loc of sprite 24
- set the loc of sprite 22 to point(-10000, -10000)
- set the loc of sprite 23 to point(-10000, -10000)
- set the loc of sprite 24 to point(-10000, -10000)
- updateStage()
- put EMPTY into field "fSourceList"
- put EMPTY into field "fDestList"
- set the foreColor of field "fOnOffMulti" to gNero
- set the foreColor of field "fSourceList" to gNero
- set the foreColor of field "fDestList" to gNero
- set tempSources to EMPTY
- set tempDests to EMPTY
- set oldDelimiter to the itemDelimiter
- set the itemDelimiter to gSep
- repeat with i = 1 to gMaxMulti
- set myItem to getAt(gTempMultiPathSourceList, i)
- if myItem = 0 then
- set myItem to " "
- else
- set myItem to the last item in myItem
- end if
- put myItem & RETURN after tempSources
- set myItem to getAt(gTempMultiPathDestList, i)
- if myItem = 0 then
- set myItem to " "
- else
- set myItem to the last item in myItem
- end if
- put myItem & RETURN after tempDests
- end repeat
- set the itemDelimiter to oldDelimiter
- delete char -30000 of tempSources
- delete char -30000 of tempDests
- put tempSources into field "fSourceList"
- put tempDests into field "fDestList"
- repeat with i = 1 to gMaxMulti
- if not getAt(gTempMultiOnList, i) then
- set the foreColor of line i of field "fOnOffMulti" to gGrigio
- set the foreColor of line i of field "fSourceList" to gGrigio
- set the foreColor of line i of field "fDestList" to gGrigio
- end if
- end repeat
- set the loc of sprite 22 to pos22
- set the loc of sprite 23 to pos23
- set the loc of sprite 24 to pos24
- updateStage()
- end
-
- on SetIngrigisceMulti
- global gTempMultiAll
- if not value(gTempMultiAll) then
- set myPoint to point(the left of sprite 17 + 1, the top of sprite 17 + 1)
- set the loc of sprite 100 to myPoint
- else
- set the loc of sprite 100 to point(10000, 10000)
- end if
- updateStage()
- end
-